<?php
namespace App\Console\Commands\Tasks;

use Illuminate\Console\Command;

class IndexHotCommand extends Command
{
    //命令名
    protected $signature = 'task:index_hot';

    //命令描述:根据配置自动上线活动
    protected $description = 'refresh index hot';

    public function __construct()
    {
        parent::__construct();
    }

    //业务处理
    public function handle()
    {
        //每15s刷新一次
        //xx类型的房间
        $typeList = app("repo_index")->getNewRoomType();
        $typeIds = [];
        foreach ($typeList as $k=>$v){
            if($v['id']>0){
                $typeIds[] = $v['id'];
            }
        }
        foreach ($typeIds as $k=>$v){
            app("repo_index")->getTypeRoomListCache($v,1,50,0,1);
            app("repo_index")->getTypeRoomListCache($v,1,50,1,1);
        }
        
        //热门房间
        app("repo_user_room")->getHotRoomListCache(1);
        //推荐房间
        app("repo_index")->recommendListCache(0,1);
        app("repo_index")->recommendListCache(1,1);
    }

}
